<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Rep\MaterialTypeRep;
use Illuminate\Http\Request;

class MaterialType extends Controller
{
    //材料分类
    protected $rep;

    public function __construct(Request $request)
    {
        $this->rep = new MaterialTypeRep();
    }

    /**
     * @param Request $request
     */
    public function getMaterialTypeList(Request $request){
        $params = $request->all();
        $data = $this->rep->getMaterialTypeListRep($params);
        return re(0,$data,'success');
    }

    /**
     * @param Request $request
     */
    public function createMaterialType(Request $request){
        $params = $request->all();
        $data = $this->rep->createMaterialTypeRep($params);
        return re($data['code'],$data['data']);
    }

    /**
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function delMaterialType(Request $request){
        $params = $request->all();
        $data = $this->rep->delMaterialTypeRep($params);
        return re($data['code']);
    }
}
